package com.tsing.common.exceptions;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletRequest;

@ApiIgnore
@RestController
public class ErrorController {

    /**
     * @ControllerAdvice 无法获取到Filter的异常，因此重新抛出异常
     */
    @RequestMapping("/error/exthrow")
    public void rethrow(HttpServletRequest request) {
        throw ((BusinessException) request.getAttribute("filter.error"));
    }

}
